/* H.Filter: Functions and data structures for handling command filters */

typedef struct _filter
{
	char *file[2];	/* The names of the pipe files		*/
	FILE *fd_in;	/* The file to write data into the pipe	*/
	FILE *fd_out;	/* The file to read data from the pipe	*/
	int retval;	/* The last command return value	*/
	int in;		/* Index of the current input file	*/

	struct _filter *next;
	struct _filter *prev;
}
FILTER;

extern FILTER *FLTopen (void);
extern int FLTfilter (FILTER *, char *);
extern int FLTclose (FILTER *);

/* The input and output file descriptors. Note that you write to fltin(),
 * and read from fltout(). You can read from fltout() at any stage of a
 * pipe (you get an empty output prior to the first command), but you can
 * only write to fltin() prior to executing the first command. After the
 * first command, fltin() is set to NULL.
 */

#define FLTin(f) (f->fd_in)
#define FLTout(f) (f->fd_out)

#define FILTER_ERROR (-2)
